home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / misc / vpan100.zip / VPINDIC.H < prev    next >
C/C++ Source or Header  |  1995-01-12  |  4KB  |  124 lines

  1. //
  2. //  VIRTUAL PANELS * GRAPHIC USER UNTERFACE FOR LABORATORY WORKS
  3. //
  4. //        VPINDIC.H : CLASS: Indicator
  5. //
  6. //                       |     Written by O.Rasizade
  7. //    declarations       |        Sept 1992, 1993
  8. //                       |
  9. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  10.  
  11. #ifndef __cplusplus
  12. #error Must use C++ 
  13. #endif
  14.  
  15. #ifndef __VPINDIC_H
  16. #define __VPINDIC_H
  17.  
  18.  
  19. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  20. //++++++++++++++ CLASS   << Indicator >>  +++++++++++++++
  21. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  22.  
  23. struct indicatorcolors{ COLORS
  24.                title,    // color of title
  25.                foregr,    // foreground color
  26.                backgr;    // background color
  27.                };
  28.  
  29. const indicatorcolors LEDind={
  30.                BLUE,    // color of title
  31.                LIGHTRED,// foreground color
  32.                RED    // background color
  33.                };
  34. const indicatorcolors LUMind={
  35.                BLUE,    // color of title
  36.                LIGHTGREEN,// foreground color
  37.                BLACK    // background color
  38.                };
  39.  
  40. const indicatorcolors LCDdark={
  41.                BLUE,    // color of title
  42.                DARKGRAY,// foreground color
  43.                BROWN    // background color
  44.                };
  45.  
  46. const indicatorcolors LCDbright={
  47.                BLUE,    // color of title
  48.                DARKGRAY,// foreground color
  49.                YELLOW    // background color
  50.                };
  51.  
  52. class _Indicator: public display,public object
  53. {
  54. protected:
  55.   int dispwid;        // display width in chars
  56.   char *fmt;        // format
  57.   int  numbfont,numbfontsize;    // font and size of number
  58.  
  59.   plaquecolors indframecolors;
  60.   indicatorcolors indcolors;    // disp colors are inherited
  61.  
  62.  public:
  63.  
  64.   //------- Constructor ------ All coord. and sizes in VGA pixels ----
  65.   _Indicator(
  66.     int _x0,int _y0,// left top coord where to paint the indicator
  67.     objtype _type,    // may be FIXED,PERM,POPUP
  68.     char *_title,     // title
  69.     int dispwidth,    // display width in chars
  70.     char *format,  //  format
  71.               // Hearafter are defaults
  72.     int _frame=UNFRAMED,        // display may FRAMED or UNFRAMED
  73.     void (far *_paintproc)()=procNULL,// proc created by programmer
  74.                   // to repaint indicator, only for PERM
  75.  
  76.     int  numberfont=0,int numberfontsize=1,//font and size of number
  77.     int  _titlefont=0,int _titlefontsize=1,    //font and size of title
  78.  
  79.     plaquecolors indframecolcnfg=plaquecoldflt,// colors of frame
  80.     indicatorcolors indcolcnfg=LCDdark);  // colors of screen and numbers
  81.     //-------- end of constructor declaration ------
  82.  
  83. virtual void  Paint(void);
  84.     void  Put(...);
  85.     void  Puts(char *str);
  86. //also  void cls() inherited from display
  87. };
  88.  
  89. template <class T>
  90. class Indicator: public _Indicator
  91. {
  92.  T * variable;
  93.  
  94.  public:
  95.  
  96.   //------- Constructor ------ All coord. and sizes in VGA pixels ----
  97.  Indicator(
  98.     int _x0,int _y0,// left top coord where to paint the indicator
  99.     objtype _type,    // may be FIXED,PERM,POPUP
  100.     char *_title,     // title
  101.     int dispwidth,    // display width in chars
  102.     T *_variable, char *format,  //  format of varible's output
  103.               // Hearafter are defaults
  104.     int _frame=UNFRAMED,        // display may FRAMED or UNFRAMED
  105.     void (far *_paintproc)()=procNULL,// proc created by programmer
  106.                   // to repaint indicator, only for PERM
  107.  
  108.     int  numberfont=0,int numberfontsize=1,//font and size of number
  109.     int  _titlefont=0,int _titlefontsize=1,    //font and size of title
  110.  
  111.     plaquecolors indframecolcnfg=plaquecoldflt,// colors of frame
  112.     indicatorcolors indcolcnfg=LCDdark):  // colors of screen and numbers
  113.  
  114.    _Indicator(_x0,_y0,_type,_title, dispwidth, format, _frame,
  115.           _paintproc, numberfont, numberfontsize,
  116.           _titlefont, _titlefontsize, indframecolcnfg, indcolcnfg)
  117. { variable = _variable; }
  118.  
  119.  void  Refresh(void)
  120.     { cls(); Put(*variable); }
  121.  
  122. };//++++++++++++++ END of class Indicator +++++++++++++++++++
  123.  
  124. #endif // __VPINDIC_H